/**
 * TP no: 2
 * 
 * Titre du TP : 
 *
 * Date : 09 oct 2010
 * 
 * Nom  : NGUYEN
 * Prenom : Quang-Hoang
 * 
 * Remarques :
 */


import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.DataInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Vector;

public class Jointure {
	
	public Jointure()
	{				
		
		/*try{			
			readFromFileToRelation("R.txt",R);
			readFromFileToRelation("S.txt",S);						
		}
		catch (Exception e) {
			System.out.print(e);
		}*/
    	
	}
			
	public Vector<String> join(Vector<String>R, Vector<String>S){		
		Collections.sort(R);
		Collections.sort(S);
		
		Vector<String>RS = new Vector<String>();
		
		System.out.println("Joining...");
		for(String c: R){
			if(S.contains(c)){
//				System.out.print(c);
//				output(c);
				RS.add(c);
			}		    	
	    }
		return RS;
	}
}
